package com.example.forjava.aspect;

import com.example.forjava.controller.AopController;
import org.aspectj.lang.ProceedingJoinPoint;

//@Aspect
//@Component
//@Order(1) //相同切面数字越小执行顺序越靠前
public class PermissionSecondAdvice {
    // 定义一个切面，括号内写入第1步中自定义注解的路径
    //@Pointcut("@annotation(com.example.forjava.annotation.PermissionAnnotation)")
    private void permissionCheck() {
    }

    //@Around("permissionCheck()")
    public Object permissionCheckFirst(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("===================第二个切面===================：" + System.currentTimeMillis());
        //获取请求参数，详见接口类
        AopController.User args = (AopController.User) joinPoint.getArgs()[0];
        System.out.println(args.getName());
        return joinPoint.proceed();
    }
}
